var player = null ;
var curPlayData = null;			//记录当前播放的data
var isInitBuffer = false;
var lastProcess = 0;
function play(data){
	
	
	
	hideGTip();
	
	
	if(data == curPlayData ){			//如果是当前正在播放的
		return ;
	}
	if(curPlayData){
		//IMPlayer.Stop();
	}
	
	curPlayData = data;
	showEpgBox(data);
	
	
	var	playUrl = data.playUrl;
	
	if(playUrl.indexOf('igmp') >-1){
		playUrl ='udp'+playUrl.substring(4);
	}
	
	isInitBuffer = true;
	lastProcess = 0;
	changeEPGBuffer(lastProcess);
	try {	
		IMPlayer.Play(playUrl,5);
	}catch (e) {
        $.log(e);
	}
	myPlayer.disName = data.name;
	
	
	
	
}


function OnStateChanged(state, percent,speed){ $.log(state);
	myPlayer.state = state;  
	if ("play" == state) {
		hideEPGBuffer();
		hideEpgBox();
		isInitBuffer = false;
		hideBackground();
	}else if("buffer" == state){
		if(isInitBuffer){
			if(percent > lastProcess){lastProcess = percent;}
			if(lastProcess>100){lastProcess = 100;}
			changeEPGBuffer(lastProcess);
		}else{
		
		}
	}
}


var hasHideBackground = false;
function hideBackground(){
	if(!hasHideBackground){
		
		$('#pagewrap').attr("style","background: url();");
		hasHideBackground = true;
	}
}